<template>
  <div class="greenhouse">
    <!-- 按钮 -->
    <div class="btns">
      <el-button type="primary" size="small">新增</el-button>
    </div>
    <!-- /按钮 -->
    <!-- {{greenhouse}} -->
    <!-- 表格 -->
    <el-table size="small" :data="greenhouse">
      <el-table-column type="index" :index="1" label="序号"></el-table-column>
      <el-table-column label="名称" prop="name" align="center"></el-table-column>
      <el-table-column label="状态" prop="status" align="center"></el-table-column>
      <el-table-column label="气温" prop="temperature" align="center"></el-table-column>
      <el-table-column label="空气湿度" prop="airHumidity" align="center"></el-table-column>
      <el-table-column label="土壤湿度" prop="soilHumidity" align="center"></el-table-column>
      <el-table-column label="照片" prop="photo" align="center"></el-table-column>
      <el-table-column label="创建时间" prop="createTime" align="center"></el-table-column>
      <el-table-column label="用户名" prop="userId" align="center"></el-table-column>
       
    </el-table>
    <!-- /表格 -->
  </div>
</template>
<script>
import {get,post} from '@/utils/request'
export default {
  // 页面数据
  data(){
    return {
     greenhouse:[]
    }
  },
  // 页面渲染的时候会调用的函数
  created(){
    this.loadgreenhouse();
  },
  // 所有的方法
  methods:{
    loadgreenhouse(){
      let url = 'http://localhost:8888/greenhouse_greenhouse/query'
      get(url).then((resp)=>{
        this.greenhouse = resp.data;
      })
    }
  }
}
</script>
<style scoped>

</style>